package com.whp.test;

import org.springframework.beans.BeansException;
import org.springframework.beans.factory.support.DefaultListableBeanFactory;
import org.springframework.context.expression.StandardBeanExpressionResolver;
import org.springframework.context.support.ClassPathXmlApplicationContext;

/**
 * @author wanghp
 * @version 1.0
 * @date 2020/7/13 17:49
 */

public class MyClassPathXmlApplicationContext extends ClassPathXmlApplicationContext {

	public MyClassPathXmlApplicationContext(String... configLocations) throws BeansException {
		super(configLocations);
	}

	/**
	 * @param beanFactory the newly created bean factory for this context
	 *                    SpEL语法：
	 *                    <property name="message" value="#{message}"/> SpEL语法
	 *                    <property name="message" ref="message"/>
	 */
	@Override
	protected void customizeBeanFactory(DefaultListableBeanFactory beanFactory) {
		//设置这个就可以对SpEL进行解析了，
	//	beanFactory.setBeanExpressionResolver(new StandardBeanExpressionResolver());
		super.setAllowBeanDefinitionOverriding(false);
		super.setAllowCircularReferences(false);
		super.customizeBeanFactory(beanFactory);
	}


//	@Override
//	protected void initPropertySources() {
//		getEnvironment().setRequiredProperties("VAR");
//	}
}
